package org.jeecg.modules.flowable.enums;

/**
 * 流程参与者类型
 */
public enum ParticipantTargetTypeEnum {


    USER(1, "user", "用户"),
    ROLE(2, "role", "角色"),
    DEPT(3, "dept", "部门");


    final Integer code;

    final String key;

    final String desc;

    ParticipantTargetTypeEnum(Integer code, String key, String desc) {
        this.code = code;
        this.key = key;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static ParticipantTargetTypeEnum formCode(Integer code) {
        if (null == code) {
            return USER;
        }
        for (ParticipantTargetTypeEnum type : ParticipantTargetTypeEnum.values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return USER;
    }
}
